<!--
 * new page
 * @author: liuxin
 * @since: 2024-08-16
 * delete_admin.vue
-->
<template>
    <el-dialog v-model="dialogFormVisible" title='清空列表' width="30%" center>
        <span>请谨慎操作，您确定要真正清空这个列表吗？</span>
        <template #footer>
            <span class="dialog-footer">
                <el-button type="primary" @click="clearList">确定</el-button>
            </span>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
import { ref, onBeforeUnmount } from "vue"
// import { bus } from "@/utils/mitt.js"
import { clearloginLogList } from '@/api/log'
import { ElMessage } from 'element-plus'



const emit = defineEmits(['success'])
// 删除产品
const clearList = async () => {
    const res = await clearloginLogList()
    if (res.status == 0) {
        ElMessage({
            message: '清空列表成功',
            type: 'success'
        })
        emit('success')
        dialogFormVisible.value = false
    } else {
        ElMessage.error('清空列表失败')
        dialogFormVisible.value = false
    }
}


// 弹窗开关

const dialogFormVisible = ref(false)
// 打开编辑管理员弹窗
const open = () => {
    dialogFormVisible.value = true
}
defineExpose({
    open
})

/* // 取消订阅/监听
onBeforeUnmount(() => {
    bus.all.clear()
}) */
</script>

<style scoped lang="scss"></style>